package com.wenyu.wenyuyuedu.adapter.circleAdapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.wenyu.wenyuyuedu.R;
import com.wenyu.wenyuyuedu.bean.circle.CircleDetailBean;

import java.util.List;

/**
 * Created by Administrator on 2017/3/2.
 * 书圈----我的---全部
 */

public class CircleDetailAdapter extends BaseAdapter {
    private List<CircleDetailBean.InfoBeanX.InfoBean> info ;
    public Context context;
    private View inflate;

    public CircleDetailAdapter(Context context, List<CircleDetailBean.InfoBeanX.InfoBean> info) {
        this.context = context;
        this.info = info;
    }

    @Override
    public int getCount() {
        return info.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        CircleDetailHolder holder = null;
        if (view != null) {
            return view;
        }
        if (view == null) {
            holder = new CircleDetailHolder();
            inflate = View.inflate(context, R.layout.mycircle_mine_add_item, null);
            holder.hoeme_all_nickname = (TextView)inflate.findViewById(R.id.hoeme_all_nickname);
            holder.home_all_head = (ImageView)inflate.findViewById(R.id.home_all_head);
           // holder.home_all_shen = (ImageView)inflate.findViewById(R.id.home)
            inflate.setTag(holder);
        }else{
            holder = (CircleDetailHolder) inflate.getTag();
        }
       /* Glide.with(context)
                .load(info.get(i).getAvatar())
                .into(holder.home_all_head);
*/
        return inflate;
    }

    public void AddAll(List<CircleDetailBean.InfoBeanX.InfoBean> info) {
        if (info != null) {
            this.info.clear();
            this.info.addAll(info);
            notifyDataSetChanged();
        }
    }

    class CircleDetailHolder {
        ImageView home_all_head,home_all_shen;
        TextView hoeme_all_nickname;

    }
}
